package com.sdy.supermarket.biz.service.impl;

import com.sdy.supermarket.biz.model.GsAppInterface;
import com.sdy.supermarket.biz.mapper.GsAppInterfaceMapper;
import com.sdy.supermarket.biz.service.GsAppInterfaceService;
import com.sdy.mvc.service.impl.BaseServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zzq
 * @since 2019-07-30
 */
@Slf4j
@Service
public class GsAppInterfaceServiceImpl extends BaseServiceImpl<GsAppInterface> implements GsAppInterfaceService {
    @Autowired
    private GsAppInterfaceMapper gsAppInterfaceMapper;

    @Override
    public List<GsAppInterface> listByAppCode(String appCode) {
        if (appCode == null) {
            return Collections.emptyList();
        }
        return lambdaQuery().eq(GsAppInterface::getAppCode, appCode).list();
    }

    @Override
    public List<GsAppInterface> listByAppCodeList(List<String> appCodeList) {
        if (appCodeList == null || appCodeList.isEmpty()) {
            return Collections.emptyList();
        }
        return lambdaQuery().in(GsAppInterface::getAppCode, appCodeList).list();
    }

    @Override
    public List<GsAppInterface> listByAppId(Integer appId) {
        if (appId == null) {
            return Collections.emptyList();
        }
        return gsAppInterfaceMapper.listByAppId(appId);
    }
}
